/*================================================================
*   Copyright (C) 2017 LiuYao. All rights reserved.
*   
*   Filename : context.h
*   Author : LiuYao
*   Date : 2017-12-20
*   Description : the runtime context
*
================================================================*/
#ifndef _CONTEXT_H
#define _CONTEXT_H

#include <unordered_map>
#include "../graph/node.h"
#include "../matrix/matrix.h"

using std::unordered_map;

class Node;

class Context{
    private:
        unordered_map<Node*, unsigned int> node2inNum_;
        unordered_map<Node*, unsigned int> node2outNum_;
        unordered_map<Node*, Matrix> node2value_;
    
    public:
        Context(unordered_map<Node*, unsigned int> node2inNum, 
                unordered_map<Node*, unsigned int> node2outNum,
                unordered_map<Node*, Matrix> node2value)
            : node2inNum_(node2inNum), node2outNum_(node2outNum), node2value_(node2value){}
        unordered_map<Node*, unsigned int> getInNumOfNodeMap() { return node2inNum_; }
        unordered_map<Node*, unsigned int> getOutNumOfNodeMap() { return node2outNum_; }
        Matrix getFlowedData(Node* node) { return node2value_[node]; }
        void setFlowedData(Node* node, Matrix value) { node2value_[node] = value; }
        void eraseFlowedData(Node* node) { node2value_.erase(node); }
        void printValueMap();
};

#endif
